package com.yunsc.common.base; /**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-05-04 21:40
 */
/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录用户id
 */
public class BaseContext {
    private static ThreadLocal<ClientInfo> threadLocal = new ThreadLocal<>();

    /**
     * 设置值
     * @param clientInfo
     */
    public static void setCurrentClientInfo(ClientInfo clientInfo){
        threadLocal.set(clientInfo);
    }
    /**
     * 获取值
     * @return ClientInfo
     */
    public static ClientInfo getCurrentClientInfo(){
        return threadLocal.get();
    }
    /**
     * 获取当前店铺id
     * @return 当前店铺id
     */
    public static Integer getCurrentStoreId(){
        return threadLocal.get().getStoreId();
    }
}